﻿// Copyright (c) ZhangPeihang. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using LaserMark.DataAccess.Models;

namespace LaserMark.DataAccess.Service;

public class AuditService : IAuditService
{
    private IDBManager DBManager { get; set; }

    public AuditService(IDBManager dBManager)
    {
        DBManager = dBManager;
    }

    public void Log(AuditLog log)
    {
        using var db = DBManager.Create();
        db.Insert(log);
    }

    public Task<List<AuditLog>> GetAll()
    {
        using var db = DBManager.Create();
        return Task.FromResult(db.Fetch<AuditLog>());
    }
}
